# 构建镜像
# DOCKER_BUILDKIT=1 docker buildx build --push -t weifashi/php:8.1-swoole --platform linux/amd64,linux/arm64 .
# 提交镜像到docker
# docker commit 0212f203320e imagecommit
# 推送 
# docker push weifashi/php:8.1-swoole

FROM phpswoole/swoole:php8.1

# 设置时区
ENV TZ=Asia/Shanghai
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

# 更新安装依赖包和PHP核心拓展
RUN apt-get update && apt-get install -y --no-install-recommends libfreetype6-dev libjpeg62-turbo-dev libpng-dev libgmp-dev curl supervisor cron vim \
        && apt-get install -y sshpass git \
        && apt-get install -y zip unzip \
        && apt-get install -y wget \
        && rm -r /var/lib/apt/lists/* \
        && docker-php-ext-configure gd --enable-gd --with-freetype --with-jpeg \
        && docker-php-ext-install -j$(nproc) gd opcache pdo_mysql gettext sockets bcmath gmp mysqli 

# 配置 crontab
RUN mkdir -p /var/spool/cron/crontabs
RUN echo '* * * * * bash /var/www/docker/crontab/crontab.sh' >> /var/spool/cron/crontabs/cron
RUN crontab /var/spool/cron/crontabs/cron 

# 启动 supervisord
RUN supervisord -c /etc/supervisor/supervisord.conf 


# 设置工作目录
WORKDIR /var/www

